package DAO;

import Exceptions.DaoException;

import Interfaces.IStoreEntry_Dao;
import Models.StoreEntry;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;


public class StoreEntry_Dao implements IStoreEntry_Dao {  

    @Override
    public StoreEntry validateStoreEntry(String StoreName, String Address, String City, String StorePhone, String Floors, String Seats, String Parking, String ParkingSpots, String DaysOpen) throws DaoException {
        Connection conn = null;
        PreparedStatement pst = null;
        conn = javaconnect2.connectDB();
        try {
            String query = "INSERT INTO stores (storename , address , city , storephone , floors , seats , parking, parkingspots, daysopen) value (?,?,?,?,?,?,?,?,?)";
            pst = conn.prepareStatement(query);
            pst.setString(1, StoreName);
            pst.setString(2, Address);
            pst.setString(3, City);
            pst.setString(4, StorePhone);
            pst.setString(5, Floors);
            pst.setString(6, Seats);
            pst.setString(7, Parking);
            pst.setString(8, ParkingSpots);
            pst.setString(9, DaysOpen);
            pst.execute();
            pst.close();
            conn.close();
            
        } catch (SQLException e) {
            throw new IllegalArgumentException("Error in Store Entry");
        }
        return null;
    }

}
